//
//  WeekDayModel.m
//  时间选择
//
//  Created by wsj2015 on 15/9/18.
//  Copyright (c) 2015年 wsj2015. All rights reserved.
//

#import "WeekDayModel.h"


#import "WCNTemperiodIdForAdd.h"
@implementation WeekDayModel
-(void)setValue:(id)value forUndefinedKey:(NSString *)key{}

-(NSArray *)amArray
{
    if (!_amArray) {
        return nil;
    }
    return [self sortedTimeProid:_amArray];
}
-(NSArray *)pmArray
{
    if (!_pmArray) {
        return nil;
    }
    return [self sortedTimeProid:_pmArray];
 
}
- (NSArray *)sortedTimeProid:(NSArray *)array
{
    NSMutableArray *mulArr =[NSMutableArray arrayWithArray:array];
    for (int i =0 ; i<array.count; i++) {
        for (int j =  i+1; j<array.count; j ++) {
            WCNTemperiodIdForAdd *model1 =array[i];
            WCNTemperiodIdForAdd *model2 =array[j];
            if ([model1.wcnId integerValue] > [model2.wcnId integerValue]) {
                [mulArr exchangeObjectAtIndex:i withObjectAtIndex:j];
            }
        }
    }
    array = mulArr;
    return array;
    
}

@end
@implementation timePeroidModel

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{}

- (void)changeStatuWithSelcetedStaue:(BOOL)isSelected
{
    if (isSelected) {
        self.isSelectdItem =YES;
    }else{
        self.isSelectdItem =NO;
    }

}
//@property (strong, nonatomic)NSString *weekDayId;
//@property (strong, nonatomic)NSString *weekDay;
//@property (strong, nonatomic)NSString *timePeriodId;
//@property (strong ,nonatomic)NSString *ampmFlag;
//@property (strong, nonatomic)NSString *timePeriod;
-(NSDictionary *)modelToDictionary
{
    NSMutableDictionary *dict =[NSMutableDictionary dictionary];
    dict[@"weekDayId"] =self.weekDayId;
    dict[@"weekDay"] =self.weekDay;
    dict[@"timePeriodId"] =self.timePeriodId;
    dict[@"ampmFlag"] =self.ampmFlag;
    dict[@"timePeriod"] =self.timePeriod;
    return [NSDictionary dictionaryWithDictionary:dict];

}
@end